package cn.nnxy.zentao.controller;

import cn.nnxy.zentao.domain.ZtTask;
import cn.nnxy.zentao.query.projectsTest.ProjectsQuery;
import cn.nnxy.zentao.service.ProjectsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName TempController
 * @Author Yuan Zhiqiang
 * @Version 1.0.0
 * @Description 临时测试类
 * @CreateTime 2021年06月16日 09:08:10
 */
@Controller
@RequestMapping("/temp")
public class TaskController {
    @Autowired
    private ProjectsService projectsService;

    @GetMapping("index")
    public String indexUI(){
        return "projectsTest/index";
    }

    @GetMapping("project-index-no")
    public String temp(){
        return "projectsTest/project-index-no";
    }

    @GetMapping("product-showErrorNone-qa")
    public String temp2(){
        return "projectsTest/product-showErrorNone-qa";
    }

    @GetMapping("product-index-no")
    public String temp3(){
        return "projectsTest/product-index-no";
    }

    @GetMapping("repo-browse")
    public String temp4(){
        return "projectsTest/repo-create";
    }

    @GetMapping("doc")
    public String temp5(){
        return "projectsTest/doc";
    }

    @GetMapping("report-productSummary")
    public String temp6(){
        return "projectsTest/report-productSummary";
    }

    @GetMapping("company-browse")
    public String temp7(){
        return "projectsTest/company-browse";
    }

    @GetMapping("admin")
    public String temp8(){
        return "projectsTest/admin";
    }

    @GetMapping("my-profile")
    public String temp9(){
        return "projectsTest/my-profile";
    }

    @GetMapping("my-changepassword")
    @ResponseBody
    public String temp10(){
        return "projectsTest/my-changepassword";
    }

    @GetMapping("misc-changeLog")
    public String temp11(){
        return "projectsTest/misc-changeLog";
    }

    @GetMapping("misc-about")
    public String temp12(){
        return "projectsTest/misc-about";
    }

    @GetMapping("user-logout")
    public String temp13(){
        return "projectsTest/user-logout";
    }

    @GetMapping("project-task-2")
    public String temp14(){
        return "projectsTest/project-task-2";
    }

    @GetMapping("project-task")
    public String queryAllUser(ProjectsQuery projectsQuery, Model model){
        PageHelper.startPage(projectsQuery.getCurPage(), projectsQuery.getPageSize());
        List<ZtTask> task = projectsService.queryAllTask(projectsQuery);
        PageInfo<ZtTask> pageInfo = new PageInfo<>(task);

        model.addAttribute("pageInfo",pageInfo);
        // model.addAttribute("projectsQueryBack",projectsQuery);

        return "projectsTest/project-task";
    }



}
